]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
backlight: Allow operating the keyboard backlight slider by keyboard
authorLukáš Tyrychtr <ltyrycht@redhat.com>
Thu, 7 Nov 2024 12:45:03 +0000 (13:45 +0100)
committerFlorian Müllner <fmuellner@gnome.org>
Tue, 12 Nov 2024 23:57:11 +0000 (00:57 +0100)
Also, hide its menu item from the a11y tree, similarly to the volume and
other sliders.

Closes https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/6894

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/3538>

js/ui/status/backlight.js

index a6ececc1386896faa42dd3cfa954ce59b5969176..105aabc4772219a225734a275b1e277621ac5936 100644 (file)
@@ -55,6 +55,14 @@ const SliderItem = GObject.registerClass({
 
         this.notify('value');
     }
+
+    vfunc_key_press_event(event) {
+        const key = event.get_key_symbol();
+        if (key === Clutter.KEY_Left || key === Clutter.KEY_Right)
+            return this._slider.vfunc_key_press_event(event);
+        else
+            return super.vfunc_key_press_event(event);
+    }
 });
 
 const DiscreteItem = GObject.registerClass({
@@ -163,6 +171,10 @@ class KeyboardBrightnessToggle extends QuickMenuToggle {
 
         this._sliderItem = new SliderItem();
         this.menu.box.add_child(this._sliderItem);
+        const sliderAccessible = this._sliderItem._slider.get_accessible();
+        sliderAccessible.set_parent(this.menu.box.get_accessible());
+        this._sliderItem.set_accessible(sliderAccessible);
+
 
         this._discreteItem = new DiscreteItem();
         this.menu.box.add_child(this._discreteItem);